<?
include("includes/config.inc.php");
include("includes/auth.lib.php");
include("includes/product_new.class.php");
$filename = $path_tmp."mpf.csv";
		$row = 1;
		$count = 0;
		if(($handle = fopen($filename, "r")) !== FALSE) {
			while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
				if($row > 1) {
					$num = count($data);
					if($data[1]!="" && $data[0]!="")
					$codice = trim($data[1]);
					$result = "UPDATE articoli_new SET cid='".$data[0]."' WHERE codice='$codice';";
					//die($result);
					$rs = $conn->Execute($result);
					if($rs)
					$count++;
					else
					return "Problemi durante l'importazione!<br>Errore: ".$conn->ErrorMsg();
				}
				$row++;
			}
			fclose($handle);
			@unlink($filename);
		}
		//return $result;
		echo "Sono stati aggiornati $count articoli!";
?>